<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.min.js"></script>
    <script src="../../js/iview.min.js"></script>
    <link rel="stylesheet" href="../../css/iview.css">
</head>
<body>
<div id="app">
    <my-component :width="100"></my-component>

</div>
<script>
    Vue.component('my-component', {
        props: ['width'],
        template: "<div :style='style'>组件内容</div>",
        computed: {
            style: function () {
                return {
                    width: this.width + 'px'
                }
            }
        }
    });
    var app = new Vue({
        el: "#app",
        data: {}
    })
</script>
</body>
</html>